package com.zeta.gateway;

import cn.dev33.satoken.spring.pathmatch.SaPathMatcherHolder;
import cn.dev33.satoken.strategy.SaStrategy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;

/**
 * 网关服务 启动类
 *
 * @author gcc
 */
@ComponentScan(basePackages = {"com.zeta", "org.zetaframework"})
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);

        // 重写路由匹配算法，切换为 ant_path_matcher 模式，使之可以支持 `**` 之后再出现内容
        SaStrategy.instance.routeMatcher = (pattern, path) ->
                SaPathMatcherHolder.getPathMatcher().match(pattern, path);
    }
}
